import request from "@/utils/request"

// 获取省数据
export const reqProvinceData = () => request.get<any,any>('/address/province')

// 获取市数据
export const reqCityData = (province:string) => request.get<any,any>(`/address/city?provinceCode=${province}`)

// 获取区数据
export const reqAreaData = (city:string) => request.get<any,any>(`/address/area?cityCode=${city}`)

// 获取地址列表
export const reqAddressList = (userId:string) => request.get<any,any>(`/address?userId=${userId}`)

// 新增地址
export const addAddress = (data:any) => request.post<any,any>('/address',data)

// 修改地址
export const updateAddress = (data:any) => request.put<any,any>('/address',data)

// 删除地址
export const deleteAddress = (_id:any) => request.delete<any,any>(`/address/${_id}`)

// 设置默认地址
export const setDefaultAddr = (data:any) => request.post<any,any>('/address/setDefault',data)